#ifndef __SIPSRV_TRANSACTION_HPP__
#define __SIPSRV_TRANSACTION_HPP__

#include "WTResipDll/SipWTResipDllItf.hpp"
#include "WTResipDll/SipWtTypes.hpp"
//#include "resip/stack/ApplicationMessage.hxx"

namespace wtsip{

class CSipUserAgent;
class CSipDialogBase;


class RESIP_PUBLIC CSipSrvTransaction: public ISipSrvTransaction
{
public:
    CSipSrvTransaction(CSipMessage& request, CSipUserAgent& ua);

    virtual ~CSipSrvTransaction();

    virtual bool processIncoming(CapSipMessage msg);

    //virtual bool processTimeOut(ApplicationMessage* msg);

    virtual bool send(CapSipMessage msg);

    virtual bool registerListener(ISipSrvTransactionListener* callback);

    virtual bool unregisterListener(ISipSrvTransactionListener* callback);

    virtual CapSipMessage createResponse(CSipMessage& msg, const ESipCodeType code, const std::string& reason);
    
    virtual bool bindDialog(CSipDialogBase* dialog);

    virtual CSipDialogBase* getBindDlg() const;

    virtual ISipSrvTransaction::ESrvTranState getState() const;

    //SipMessage& getRequest();

    virtual const resip::Data& getTid() const;

    virtual bool hasListener() const;

protected:
    virtual bool setState(ESrvTranState state);

protected:
    ESrvTranState m_State;

    int m_Seq;

    //resip::SipMessage m_request;

    CSipUserAgent& m_ua;

    resip::Data m_tid;

    resip::MethodTypes m_mth;

    CSipDialogBase* m_bindDialog;

    ISipSrvTransactionListener* m_listener;
};



}//namespace

#endif

